package com.zwh.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zwh.entity.MybatisUser;
import com.zwh.service.IMybatisUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.Value;
import org.springframework.web.bind.annotation.*;

/**
 * 控制器
 *
 * @author
 * @since 2024-04-13
 */
@RestController
@AllArgsConstructor
@RequestMapping("/mybatisuser")
@Api(value = "zwh", tags = "zwh接口")
public class MybatisUserController{

    private final IMybatisUserService mybatisUserService;

    @GetMapping("/detail")
    @ApiOperation(value = "详情", notes = "传入mybatisUser")
    public MybatisUser detail(MybatisUser mybatisUser) {
        MybatisUser detail = mybatisUserService.getOne(Wrappers.lambdaQuery(mybatisUser));
        return detail;
    }

    @PostMapping("/selectMybatisUser")
    @ApiOperation(value = "详情", notes = "传入mybatisUser")
    public MybatisUser selectMybatisUser(@RequestBody MybatisUser mybatisUser) {
        MybatisUser detail = mybatisUserService.selectMybatisUser(mybatisUser);
        return detail;
    }

    @PostMapping("/interMybatisUser")
    @ApiOperation(value = "详情", notes = "传入mybatisUser")
    public boolean interMybatisUser(@RequestBody MybatisUser mybatisUser) {
        boolean b = mybatisUserService.save(mybatisUser);
        return b;
    }
}
